<template>
	<view class="content">
		<swiper class="swiper" :indicator-dots="true" :style="{'height':windowHeight}"
			@animationfinish="animationfinish">
			<swiper-item v-for="item in splash">
				<view class="swiper-item" :style="{'height':windowHeight}">
					<image :src="'http://localhost:8090'+item.icon" style="width: 100%;height: 100vh;"></image>
				</view>
			</swiper-item>
		</swiper>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				windowHeight: '603px',
				splash: []
			}
		},
		onLoad() {
			var _me = this;
			uni.getSystemInfo({
				success: function(res) {
					_me.windowHeight = res.windowHeight + 'px';
				}
			});
			uni.request({
				url: 'http://localhost:8090/freshmenapp/schoolSwiper/list',
				method: 'POST',
				data: {},
				success: res => {
					this.splash = res.data.list
					uni.showToast({
						title: '成功',
						icon: 'none'
					});
				},
				fail: () => {},
				complete: () => {}
			});
		},
		methods: {
			animationfinish(e) {
				console.log(JSON.stringify(e.detail.current));
				if (e.detail.current == 3) {
					setTimeout(function() {
						uni.switchTab({
							url: '/pages/index/index'
						});
					}, 1000)
				}
			}
		}
	}
</script>
<style>
	
</style>
